package com.bdqn.demo01.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.List;


public class PageTransaction implements Serializable {
    //总页数
    private int page;
    //页面显示信息量
    private int pageSize;
    //总记录
    private int count;
    //当前页面
    private int pageNo=1;
    //当前页面信息
    private List<TransactionRecord> list;

    public int offset(){
        return (pageNo-1) * pageSize;
    }

    public List<TransactionRecord> getList() {
        return list;
    }

    public void setList(List<TransactionRecord> list) {
        this.list = list;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int totalPage) {
        this.pageNo = totalPage;
    }

    public int getCount() {
        return count;
    }

    public void setTotal(int total) {
        double pageRow=(double) total/pageSize;
        this.page= (int) Math.ceil(pageRow);
        this.count = total;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int rows) {
        this.pageSize = rows;
    }
}
